import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import Login from '../views/Login.vue'
import UserManger from '../views/UserManger.vue'
import ProductManger from '@/views/ProductManger.vue'
import OrdersManger from '@/views/OrdersManger.vue'
import BannersManger from '@/views/BannersManger.vue'
import CategoryManger from '@/views/CategoryManger.vue'

const routes = [
  {
    path: '/home',
    redirect: '/'
  },
  {
    path: '/',
    name: 'home',
    component: HomeView,
    meta: {
      requiresAuth: true
    }
  },
  {
    path: '/login',
    name: 'login',
    component: Login,
    meta: {
      requiresAuth: false
    }
  },
  {
    path: '/userManger',
    name: 'userManger',
    component: UserManger,
    meta: {
      requiresAuth: true
    }
  },
  {
    path: '/productManger',
    name: 'productManger',
    component: ProductManger,
    meta: {
      requiresAuth: true
    }
  },
  {
    path: '/ordersManger',
    name: 'ordersManger',
    component: OrdersManger,
    meta: {
      requiresAuth: true
    }
  },
  {
    path: '/bannersManger',
    name: 'bannersManger',
    component: BannersManger,
    meta: {
      requiresAuth: true
    }
  },
  {
    path: '/categoryManger',
    name: 'categoryManger',
    component: CategoryManger,
    meta: {
      requiresAuth: true
    }
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
